//
//  Event.m
//  RepasoApp
//
//  Created by Vicente Vicens Camarena on 02/10/11.
//  Copyright 2011 Imathink World, S.L.N.E. All rights reserved.
//

#import "Event.h"

@implementation Event

@synthesize eventId = eventId_;
@synthesize eventTitle = eventTitle_;
@synthesize eventDescription = eventDescription_;
@synthesize eventDate = eventDate_;
@synthesize eventURL = eventURL_;

//Designated initializer
- (id)initWithDictionary:(NSDictionary *)dictionary
{
    self = [super init];
    if (self) {
        self.eventId = [dictionary objectForKey:@"event_id"];
        self.eventTitle = [dictionary objectForKey:@"event_title"];
        self.eventDescription = [dictionary objectForKey:@"event_description"];
        self.eventDate = [dictionary objectForKey:@"event_date"];
        self.eventURL = [dictionary objectForKey:@"event_url"];

    }
    
    return self;
}

- (id)init
{
    return [self initWithDictionary:nil];
}

+ (Event *)eventWithDictionary:(NSDictionary *)dictionary {
    return [[[Event alloc] initWithDictionary:dictionary] autorelease];
}

- (UIImage *)eventImage {
    return [UIImage imageNamed:@"event.png"];
}

- (void)dealloc {
    [eventId_ release];
    [eventTitle_ release];
    [eventDescription_ release];
    [eventURL_ release];
    [eventDate_ release];
    [super dealloc];
}

@end
